import { S } from '../../s';
import { IPSAppDEAction } from '../../app/dataentity/ipsapp-deaction';
import { IPSAppDEDataImport } from '../../app/dataentity/ipsapp-dedata-import';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSDEDataImport } from './ipsdedata-import';
import { IPSDEDataImportItem } from './ipsdedata-import-item';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEDataImportImpl
  extends PSModelObjectImpl
  implements IPSDEDataImport, IPSAppDEDataImport
{
  get batchSize(): number {
    return this.M.batchSize;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get createDataAccessAction(): string {
    return this.M.createDataAccessAction;
  }

  protected createpsappdeaction: IPSAppDEAction;
  getCreatePSAppDEAction(): IPSAppDEAction | null {
    if (this.createpsappdeaction != null) return this.createpsappdeaction;
    const value = this.M.getCreatePSAppDEAction;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getParentPSModelObject(
      S._f,
    ) as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.createpsappdeaction = ipsappdataentity.findPSAppDEAction(value);
    }
    return this.createpsappdeaction;
  }

  get impTag(): string {
    return this.M.impTag;
  }

  get impTag2(): string {
    return this.M.impTag2;
  }

  protected psdedataimportitems: IPSDEDataImportItem[];
  getPSDEDataImportItems(): IPSDEDataImportItem[] | null {
    return (
      this.psdedataimportitems ||
      (this.psdedataimportitems = this.fillChildListModel(
        this.M.getPSDEDataImportItems,
        S._1d7,
      ) as IPSDEDataImportItem[])
    );
  }

  findPSDEDataImportItem(objKey: any): IPSDEDataImportItem | null {
    return this.getPSModel5(
      S._1d7,
      this.getPSDEDataImportItems(),
      objKey,
    ) as IPSDEDataImportItem;
  }

  protected pssyspfplugin: IPSSysPFPlugin;
  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    return (
      this.pssyspfplugin ||
      (this.pssyspfplugin = this.fillObjectModel(
        S._27c,
        this.M.getPSSysPFPlugin,
        S._2a7,
      ) as IPSSysPFPlugin)
    );
  }

  get updateDataAccessAction(): string {
    return this.M.updateDataAccessAction;
  }

  protected updatepsappdeaction: IPSAppDEAction;
  getUpdatePSAppDEAction(): IPSAppDEAction | null {
    if (this.updatepsappdeaction != null) return this.updatepsappdeaction;
    const value = this.M.getUpdatePSAppDEAction;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getParentPSModelObject(
      S._f,
    ) as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.updatepsappdeaction = ipsappdataentity.findPSAppDEAction(value);
    }
    return this.updatepsappdeaction;
  }

  get defaultMode(): boolean {
    return this.M.defaultMode != null ? this.M.defaultMode : false;
  }

  get enableBackend(): boolean {
    return this.M.enableBackend;
  }

  get enableCustomized(): boolean {
    return this.M.enableCustomized != null ? this.M.enableCustomized : false;
  }

  get enableFront(): boolean {
    return this.M.enableFront;
  }

  get ignoreError(): boolean {
    return this.M.ignoreError;
  }

  get valid(): boolean {
    return this.M.valid != null ? this.M.valid : true;
  }
  get cls(): string {
    return 'PSDEDataImportImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._1fd || cls == S._1fe) return true;
    return super.instanceof(cls);
  }
}
